﻿/*
 * 由SharpDevelop创建。
 * 用户： 汪伟威
 * 日期: 2015/4/27
 * 时间: 17:57
 */
using System;
using System.Data;
using OpenNETCF.ORM;
using System.IO;

namespace OpenNETCFSQLiteDemo
{
	/// <summary>
	/// Description of DBFactory.
	/// </summary>
	public class DBFactory
	{
		private  SQLiteDataStore store;
		public SQLiteDataStore Get()
		{
			if(store == null)
			{
				string path = System.AppDomain.CurrentDomain.BaseDirectory;
				string dbFile = Path.Combine(path, "Demo.db3");
				store = new SQLiteDataStore(dbFile);
				if (!store.StoreExists)
            	{
                	store.CreateStore();
				}
				store.AddType<UserInfo>();
			}
			return store;
		}
		
		public DBFactory()
		{
			
		}
	}
}
